//
// Created by 32827 on 2023/11/23.
//

#ifndef YZFRAME_YZ_INTERRUPT_H
#define YZFRAME_YZ_INTERRUPT_H
#include "yz.h"

typedef void (*YZ_INT_HANDLER)(YZF_GLOBAL_INDEX index);
#define YZ_INT_DEF(name) void yz_int_set_##name(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
#define YZ_INT_METHOD(name) YZ_INT_HANDLER name##_iHandler=NULL_PTR; \
                            YZF_GLOBAL_INDEX name##_Index=YZF_GLOBAL_SHEET_ERROR_INDEX; \
                            void yz_int_set_##name(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index){ \
                                name##_iHandler=handler;\
                                name##_Index=index;\
                            }
#define YZ_INT_CALL(name) if(name##_iHandler!=NULL_PTR) name##_iHandler(name##_Index);

void yz_int_set_EXTI0(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
YZ_INT_DEF(EXTI1)
void yz_int_set_EXTI4(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_USART1(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_USART2(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_SysTick(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_SPI1(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_1(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_2(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_3(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_4(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_5(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_6(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA0_7(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA1_1(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA1_2(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA1_3(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
void yz_int_set_DMA1_4_5(YZ_INT_HANDLER handler,YZF_GLOBAL_INDEX index);
#endif //YZFRAME_YZ_INTERRUPT_H
